#include <pktbuilder/checksum.h>
#include <cassert>

using namespace pktbuilder;
int main() {
	std::vector<uint8_t> data = { 0x45, 0, 0, 0x73, 0, 0, 0x40, 0, 0x40, 0x11 , 0xc0, 0xa8, 0, 0x01, 0xc0, 0xa8, 0, 0xc7 };
	assert(calculateInternetChecksum(data) == 0xb861);
	data = { 0x45, 0, 0, 0x73, 0, 0, 0x40, 0, 0x40, 0x11 , 0xc0, 0xa8, 0, 0x01, 0xc0, 0xa8, 0, 0xc7, 0xb8, 0x61 };
	assert(calculateInternetChecksum(data) == 0);
	data = { 0, 1, 0xf2, 0x03, 0xf4, 0xf5, 0xf6, 0xf7 };
	assert(calculateInternetChecksum(data) == 0x220d);
	data = { 0, 1, 0xf2, 0x03, 0xf4, 0xf5, 0xf6, 0xf7, 0x22, 0x0d };
	assert(calculateInternetChecksum(data) == 0);
}